//17. 电话号码的字母组合  https://leetcode-cn.com/problems/letter-combinations-of-a-phone-number/
class Solution {
public:
//字符映射
    const string map[10] = {
        "", //0
        "",  //1
        "abc", //2
        "def",  //3
        "ghi",
        "jkl",
        "mno",
        "pqrs",
        "tuv",
        "wxyz"
    };
    vector<string> result;
    string temp;
    void backtracking(string digits,int itor)
    {
        if(itor == digits.size())
        {
            result.push_back(temp);
            return;
        }
        int dig = digits[itor] - '0'; //取出第n位的映射下标
        string digmap = map[dig]; //取出映射表
        for(int i = 0;i < digmap.size();i++)
        {
            temp.push_back(digmap[i]);
            backtracking(digits,itor+1);
            temp.pop_back();
        }
    }
    vector<string> letterCombinations(string digits) {
        if(digits.size() == 0)
        {
            return result;
        }
        backtracking(digits,0);
        return result;
    }
